!!!
%html{ class: "full-height #{@body_class}" }
  %head
    %meta{charset: "UTF-8"}
    %title
      = setting(:name, :site)
      - if @title.present?
        == | #{@title}
    %meta{content: "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no", name: "viewport"}
    = yield(:meta)
    = stylesheet_link_tag 'application'
    = yield(:css)
    = csrf_meta_tags
    = render partial: 'layouts/favicons'
    %link{ href: "//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,300italic,400italic,600italic|Abel", rel: "stylesheet" }
    /[if lt IE 9]
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    = yield(:head)
    :javascript
      // prevent js links from firing before the rest of the js is loaded
      window.event_queue = [];
      document.addEventListener('click', function(e) {
        if (e.target.getAttribute('href') == '#' || e.target.getAttribute('data-toggle') == 'tab') {
          e.preventDefault();
          event_queue.push(e);
        }
      }, false);
  %body{ class: @body_class || setting(:appearance, :theme), data: { 'datepicker-format' => datepicker_format } }
    %header.main-header
      = link_to setting(:name, :site), root_path, class: 'logo'
      %nav.navbar.navbar-static-top{role: "navigation"}
    %section{class: @section_class || 'content'}
      - content = yield
      - if content =~ /^\s*<div class=.row.>/m
        = flash_messages unless content =~ /class=.flash/
        - if @title
          %h2= @title
        = content
      - elsif @narrow
        .row
          .col-md-6.col-md-offset-3
            = flash_messages unless content =~ /class=.flash/
            - if title = yield(:title).presence
              = title
            - elsif @title and not @hide_title
              %h2= @title
            = content
      - else
        = flash_messages unless content =~ /class=.flash/
        - if title = yield(:title).presence
          = title
        - elsif @title and not @hide_title
          %h2= @title
        = content
    .main-footer.no-margin-left
      = render partial: 'layouts/footer_links'
    = javascript_include_tag 'application'
    = javascript_pack_tag 'application'
    = yield(:js)
    = analytics_js
